/*******************************************************************************
 * Size: 18 px
 * Bpp: 4
 * Opts: 
 ******************************************************************************/

#ifdef LV_LVGL_H_INCLUDE_SIMPLE
#include "lvgl.h"
#else
#include "lvgl/lvgl.h"
#endif

#ifndef MUYU_APP_FONT_18
#define MUYU_APP_FONT_18 1
#endif

#if MUYU_APP_FONT_18

/*-----------------
 *    BITMAPS
 *----------------*/

/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
    /* U+0030 "0" */
    0x0, 0x8d, 0xfe, 0xa2, 0x0, 0xc, 0xfc, 0x9b,
    0xfe, 0x20, 0x6f, 0xb0, 0x0, 0x6f, 0xa0, 0xbf,
    0x40, 0x0, 0xf, 0xf0, 0xdf, 0x10, 0x0, 0xd,
    0xf1, 0xef, 0x0, 0x0, 0xc, 0xf2, 0xef, 0x0,
    0x0, 0xc, 0xf2, 0xef, 0x0, 0x0, 0xc, 0xf2,
    0xdf, 0x10, 0x0, 0xd, 0xf1, 0xbf, 0x40, 0x0,
    0xf, 0xf0, 0x6f, 0xb0, 0x0, 0x7f, 0xa0, 0xc,
    0xfc, 0x9b, 0xfe, 0x20, 0x0, 0x8d, 0xfe, 0xa2,
    0x0,

    /* U+0031 "1" */
    0x0, 0x19, 0xf9, 0x8, 0xff, 0xf9, 0x4f, 0xd8,
    0xf9, 0x25, 0x4, 0xf9, 0x0, 0x4, 0xf9, 0x0,
    0x4, 0xf9, 0x0, 0x4, 0xf9, 0x0, 0x4, 0xf9,
    0x0, 0x4, 0xf9, 0x0, 0x4, 0xf9, 0x0, 0x4,
    0xf9, 0x0, 0x4, 0xf9, 0x0, 0x4, 0xf9,

    /* U+0032 "2" */
    0x0, 0x4b, 0xef, 0xc4, 0x0, 0x6, 0xfe, 0x99,
    0xff, 0x50, 0x1f, 0xd1, 0x0, 0x3f, 0xe0, 0x18,
    0x40, 0x0, 0xe, 0xf1, 0x0, 0x0, 0x0, 0xf,
    0xf0, 0x0, 0x0, 0x0, 0x6f, 0xa0, 0x0, 0x0,
    0x3, 0xfe, 0x10, 0x0, 0x0, 0x3f, 0xf3, 0x0,
    0x0, 0x3, 0xff, 0x40, 0x0, 0x0, 0x3f, 0xf4,
    0x0, 0x0, 0x3, 0xff, 0x40, 0x0, 0x0, 0x2f,
    0xfb, 0x77, 0x77, 0x71, 0x5f, 0xff, 0xff, 0xff,
    0xf2,

    /* U+0033 "3" */
    0xe, 0xff, 0xff, 0xff, 0x80, 0x6, 0x77, 0x78,
    0xff, 0x40, 0x0, 0x0, 0x1d, 0xf4, 0x0, 0x0,
    0x1, 0xdf, 0x30, 0x0, 0x0, 0x1d, 0xf4, 0x0,
    0x0, 0x1, 0xdf, 0xff, 0xd6, 0x0, 0x1, 0xd8,
    0x46, 0xef, 0x70, 0x0, 0x0, 0x0, 0x2f, 0xe0,
    0x0, 0x0, 0x0, 0xc, 0xf2, 0x2, 0x0, 0x0,
    0xd, 0xf2, 0x6f, 0x50, 0x0, 0x4f, 0xd0, 0x1d,
    0xfb, 0x8a, 0xff, 0x30, 0x1, 0x8d, 0xfe, 0xa2,
    0x0,

    /* U+0034 "4" */
    0x0, 0x0, 0x0, 0x7f, 0x60, 0x0, 0x0, 0x0,
    0x3f, 0xf6, 0x0, 0x0, 0x0, 0xd, 0xff, 0x60,
    0x0, 0x0, 0xa, 0xfa, 0xf6, 0x0, 0x0, 0x6,
    0xf8, 0x6f, 0x60, 0x0, 0x2, 0xfc, 0x6, 0xf6,
    0x0, 0x0, 0xce, 0x10, 0x6f, 0x60, 0x0, 0x8f,
    0x40, 0x6, 0xf6, 0x0, 0x4f, 0xd8, 0x88, 0xbf,
    0xb8, 0x17, 0xff, 0xff, 0xff, 0xff, 0xf3, 0x0,
    0x0, 0x0, 0x6f, 0x60, 0x0, 0x0, 0x0, 0x6,
    0xf6, 0x0, 0x0, 0x0, 0x0, 0x6f, 0x60, 0x0,

    /* U+0035 "5" */
    0xd, 0xff, 0xff, 0xff, 0x10, 0xfe, 0x77, 0x77,
    0x70, 0x1f, 0xa0, 0x0, 0x0, 0x3, 0xf8, 0x0,
    0x0, 0x0, 0x5f, 0x65, 0x76, 0x10, 0x7, 0xff,
    0xff, 0xff, 0x50, 0x8f, 0x91, 0x5, 0xff, 0x20,
    0x10, 0x0, 0x7, 0xf8, 0x0, 0x0, 0x0, 0x4f,
    0xa0, 0x20, 0x0, 0x4, 0xfa, 0xbe, 0x20, 0x0,
    0xbf, 0x54, 0xff, 0xa9, 0xdf, 0xb0, 0x3, 0xbe,
    0xfd, 0x70, 0x0,

    /* U+0036 "6" */
    0x0, 0x0, 0xb, 0xf6, 0x0, 0x0, 0x0, 0x7f,
    0x90, 0x0, 0x0, 0x3, 0xfc, 0x0, 0x0, 0x0,
    0x1e, 0xd1, 0x0, 0x0, 0x0, 0xaf, 0x77, 0x72,
    0x0, 0x4, 0xff, 0xff, 0xff, 0x90, 0xb, 0xfc,
    0x20, 0x3d, 0xf6, 0xf, 0xf1, 0x0, 0x2, 0xfd,
    0x1f, 0xc0, 0x0, 0x0, 0xff, 0xf, 0xe0, 0x0,
    0x0, 0xfe, 0xb, 0xf5, 0x0, 0x8, 0xf9, 0x2,
    0xff, 0xb9, 0xcf, 0xe1, 0x0, 0x2a, 0xef, 0xe9,
    0x10,

    /* U+0037 "7" */
    0x3f, 0xff, 0xff, 0xff, 0xf8, 0x18, 0x88, 0x88,
    0x8c, 0xf5, 0x0, 0x0, 0x0, 0xe, 0xe0, 0x0,
    0x0, 0x0, 0x6f, 0x70, 0x0, 0x0, 0x0, 0xde,
    0x0, 0x0, 0x0, 0x5, 0xf8, 0x0, 0x0, 0x0,
    0xc, 0xf1, 0x0, 0x0, 0x0, 0x4f, 0x90, 0x0,
    0x0, 0x0, 0xcf, 0x20, 0x0, 0x0, 0x3, 0xfa,
    0x0, 0x0, 0x0, 0xb, 0xf3, 0x0, 0x0, 0x0,
    0x3f, 0xb0, 0x0, 0x0, 0x0, 0xaf, 0x40, 0x0,
    0x0,

    /* U+0038 "8" */
    0x0, 0x19, 0xef, 0xea, 0x20, 0x0, 0x1e, 0xfa,
    0x8a, 0xfe, 0x10, 0x8, 0xf7, 0x0, 0x7, 0xf8,
    0x0, 0x8f, 0x50, 0x0, 0x4f, 0x90, 0x2, 0xfe,
    0x52, 0x4d, 0xf3, 0x0, 0x4, 0xff, 0xff, 0xf5,
    0x0, 0x3, 0xfe, 0x85, 0x7e, 0xf3, 0x0, 0xdf,
    0x30, 0x0, 0x2f, 0xd0, 0x1f, 0xd0, 0x0, 0x0,
    0xcf, 0x11, 0xfd, 0x0, 0x0, 0xc, 0xf1, 0xd,
    0xf5, 0x0, 0x4, 0xfd, 0x0, 0x3f, 0xfb, 0x8a,
    0xff, 0x30, 0x0, 0x29, 0xef, 0xea, 0x20, 0x0,

    /* U+0039 "9" */
    0x0, 0x4b, 0xef, 0xd7, 0x0, 0x6, 0xff, 0xa9,
    0xdf, 0xb0, 0xf, 0xf2, 0x0, 0xb, 0xf5, 0x4f,
    0xa0, 0x0, 0x4, 0xfa, 0x5f, 0x90, 0x0, 0x3,
    0xfb, 0x3f, 0xc0, 0x0, 0x7, 0xf9, 0xd, 0xf9,
    0x10, 0x5f, 0xf5, 0x2, 0xdf, 0xff, 0xff, 0xd0,
    0x0, 0x5, 0x76, 0xaf, 0x40, 0x0, 0x0, 0x5,
    0xf8, 0x0, 0x0, 0x0, 0x3f, 0xc0, 0x0, 0x0,
    0x1, 0xee, 0x20, 0x0, 0x0, 0xc, 0xf5, 0x0,
    0x0,

    /* U+003A ":" */
    0x3, 0xb, 0xf6, 0x8f, 0x40, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x30, 0xbf, 0x68, 0xf4,

    /* U+529F "功" */
    0x0, 0x0, 0x0, 0x0, 0x1, 0x30, 0x0, 0x0,
    0x0, 0x0, 0x0, 0x0, 0x0, 0x7f, 0x20, 0x0,
    0x0, 0x2, 0x22, 0x22, 0x20, 0x8, 0xf2, 0x0,
    0x0, 0x0, 0xff, 0xff, 0xff, 0x50, 0x8f, 0x20,
    0x0, 0x0, 0x6, 0x6c, 0xf7, 0x68, 0xad, 0xfb,
    0xaa, 0xaa, 0x20, 0x0, 0x9f, 0x10, 0x8f, 0xff,
    0xff, 0xff, 0xf2, 0x0, 0x9, 0xf1, 0x0, 0x9,
    0xf1, 0x0, 0x8f, 0x20, 0x0, 0x9f, 0x10, 0x0,
    0xaf, 0x0, 0x9, 0xf2, 0x0, 0x9, 0xf1, 0x0,
    0xc, 0xe0, 0x0, 0x9f, 0x20, 0x0, 0x9f, 0x10,
    0x0, 0xed, 0x0, 0xa, 0xf1, 0x0, 0x9, 0xf1,
    0x0, 0xf, 0xa0, 0x0, 0xaf, 0x0, 0x0, 0x9f,
    0x59, 0x84, 0xf7, 0x0, 0xb, 0xf0, 0x4, 0x8e,
    0xff, 0xfa, 0xaf, 0x30, 0x0, 0xcf, 0x3, 0xff,
    0xfb, 0x72, 0x3f, 0xc0, 0x0, 0xd, 0xe0, 0x7,
    0x40, 0x0, 0xd, 0xf4, 0x0, 0x0, 0xfd, 0x0,
    0x0, 0x0, 0xb, 0xf9, 0x4, 0xcc, 0xef, 0x90,
    0x0, 0x0, 0x7, 0xfb, 0x0, 0x2f, 0xfd, 0x91,
    0x0, 0x0, 0x0, 0x6, 0x0, 0x0, 0x0, 0x0,
    0x0,

    /* U+5FB7 "德" */
    0x0, 0x0, 0x10, 0x0, 0x0, 0x33, 0x0, 0x0,
    0x0, 0x0, 0x2, 0xf7, 0x0, 0x0, 0xbd, 0x0,
    0x0, 0x0, 0x0, 0xc, 0xf8, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xb0, 0x0, 0x9f, 0x52, 0x66, 0x66,
    0xde, 0x66, 0x66, 0x40, 0x7, 0xf9, 0x0, 0x33,
    0x33, 0xcd, 0x33, 0x33, 0x0, 0x3f, 0xb0, 0x83,
    0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x6, 0x6,
    0xf7, 0xf4, 0x1f, 0x33, 0xf2, 0x3f, 0x20, 0x0,
    0x1e, 0xc1, 0xf6, 0x4f, 0x55, 0xf4, 0x5f, 0x20,
    0x0, 0xbf, 0x31, 0xff, 0xff, 0xff, 0xff, 0xff,
    0x20, 0x8, 0xff, 0x30, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0, 0x5f, 0xdf, 0x3c, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xf0, 0x1a, 0x5f, 0x34, 0x66, 0x66,
    0x88, 0x66, 0x66, 0x60, 0x0, 0x4f, 0x30, 0xa5,
    0xa2, 0xdd, 0x0, 0x87, 0x0, 0x0, 0x4f, 0x35,
    0xf6, 0xf4, 0x2f, 0x80, 0x9f, 0x20, 0x0, 0x4f,
    0x3c, 0xd2, 0xf4, 0x3, 0x4d, 0x2e, 0xb0, 0x0,
    0x4f, 0x8f, 0x42, 0xf9, 0x44, 0x9f, 0x6, 0xf3,
    0x0, 0x4f, 0x36, 0x0, 0xdf, 0xff, 0xf9, 0x0,
    0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
    0x0, 0x0
};


/*---------------------
 *  GLYPH DESCRIPTION
 *--------------------*/

static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
    {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
    {.bitmap_index = 0, .adv_w = 180, .box_w = 10, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 65, .adv_w = 123, .box_w = 6, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 104, .adv_w = 159, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 169, .adv_w = 160, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 234, .adv_w = 172, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 306, .adv_w = 169, .box_w = 9, .box_h = 13, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 365, .adv_w = 170, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 430, .adv_w = 162, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 495, .adv_w = 177, .box_w = 11, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 567, .adv_w = 169, .box_w = 10, .box_h = 13, .ofs_x = 0, .ofs_y = 0},
    {.bitmap_index = 632, .adv_w = 75, .box_w = 3, .box_h = 10, .ofs_x = 1, .ofs_y = 0},
    {.bitmap_index = 647, .adv_w = 288, .box_w = 17, .box_h = 18, .ofs_x = 0, .ofs_y = -2},
    {.bitmap_index = 800, .adv_w = 288, .box_w = 18, .box_h = 18, .ofs_x = 0, .ofs_y = -2}
};

/*---------------------
 *  CHARACTER MAPPING
 *--------------------*/

static const uint16_t unicode_list_1[] = {
    0x0, 0xd18
};

/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
    {
        .range_start = 48, .range_length = 11, .glyph_id_start = 1,
        .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
    },
    {
        .range_start = 21151, .range_length = 3353, .glyph_id_start = 12,
        .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 2, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
    }
};

/*-----------------
 *    KERNING
 *----------------*/


/*Pair left and right glyphs for kerning*/
static const uint8_t kern_pair_glyph_ids[] =
{
    1, 8,
    2, 8,
    4, 2,
    4, 6,
    4, 8,
    4, 10,
    5, 2,
    5, 6,
    5, 8,
    5, 10,
    6, 2,
    6, 7,
    6, 8,
    6, 10,
    7, 2,
    7, 8,
    7, 10,
    8, 1,
    8, 5,
    8, 6,
    8, 7,
    8, 8,
    8, 9,
    9, 2,
    9, 8,
    9, 10,
    10, 4,
    10, 5,
    10, 6,
    10, 7,
    10, 8,
    10, 9
};

/* Kerning between the respective left and right glyphs
 * 4.4 format which needs to scaled with `kern_scale`*/
static const int8_t kern_pair_values[] =
{
    -10, -4, -5, -3, -7, -5, -5, -5,
    -13, -5, -5, -1, -9, -5, -14, -19,
    -9, -7, -26, -5, -18, 2, -6, -4,
    -12, -3, -2, -11, -3, -8, -8, -2
};

/*Collect the kern pair's data in one place*/
static const lv_font_fmt_txt_kern_pair_t kern_pairs =
{
    .glyph_ids = kern_pair_glyph_ids,
    .values = kern_pair_values,
    .pair_cnt = 32,
    .glyph_ids_size = 0
};

/*--------------------
 *  ALL CUSTOM DATA
 *--------------------*/

#if LV_VERSION_CHECK(8, 0, 0)
/*Store all the custom data of the font*/
static  lv_font_fmt_txt_glyph_cache_t cache;
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
    .glyph_bitmap = glyph_bitmap,
    .glyph_dsc = glyph_dsc,
    .cmaps = cmaps,
    .kern_dsc = &kern_pairs,
    .kern_scale = 16,
    .cmap_num = 2,
    .bpp = 4,
    .kern_classes = 0,
    .bitmap_format = 0,
#if LV_VERSION_CHECK(8, 0, 0)
    .cache = &cache
#endif
};


/*-----------------
 *  PUBLIC FONT
 *----------------*/

/*Initialize a public general font descriptor*/
#if LV_VERSION_CHECK(8, 0, 0)
const lv_font_t muyu_app_font_18 = {
#else
lv_font_t muyu_app_font_18 = {
#endif
    .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt,    /*Function pointer to get glyph's data*/
    .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt,    /*Function pointer to get glyph's bitmap*/
    .line_height = 18,          /*The maximum line height required by the font*/
    .base_line = 2,             /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
    .subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
    .underline_position = -1,
    .underline_thickness = 1,
#endif
    .dsc = &font_dsc           /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
};



#endif /*#if MUYU_APP_FONT_18*/

